/**
 * Lenovo Group
 * Copyright (c) 1999-2016 All Rights Reserved.
 */
package com.lenovo.lmrp.api.appgateway;

import java.util.Map;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

import com.lenovo.lmrp.api.model.RestResponse;
import com.lenovo.lmrp.api.model.view.AppVO;
import com.lenovo.lmrp.api.model.view.FeedbackVO;
import com.lenovo.lmrp.api.model.view.LoginData;
import com.lenovo.lmrp.api.model.view.TokenVO;

/**
 * 
 * @author wujin
 * @version v1.0
 */
public interface IAppSoftware {
    
    /**
     * Login App and get token that will be used in following reqeust. Client should put token to Authoriztion header
     * 
     * @param itsmcode      distinct ITSM system
     * @param loginName     user login name
     * @return
     */
    @POST
    @Path("/{itsmcode}/oauth2/token")
    public RestResponse<TokenVO> login(@PathParam("itsmcode") String itsmcode, LoginData loginData);
    
    /**
     * when App token has expired,App need re-request a token from server use  refreshToken
     * @param itsmcode distinct ITSM system
     * @param refreshToken 
     * @return
     */
    
    @POST
    @Path("/{itsmcode}/oauth2/retoken")
    public RestResponse<TokenVO> refresh(@PathParam("itsmcode") String itsmcode,Map<String, String> refreshtoken);
    
    /**
     * destory token
     * 
     * @param itsmcode
     * @return
     */
    @POST
    @Path("/{itsmcode}/oauth2/logout")
    public RestResponse<Integer> logout(@PathParam("itsmcode") String itsmcode);
    
    /**
     * 
     * Get Mobile App last version information
     * @param appName
     * @return
     */
    @GET
    @Path("/{name}/versions/last")
    public RestResponse<AppVO> getLastVersion(@PathParam("name") String appName);
    
    /**
     * App user submit comments, bug or suggestion
     * @param appName
     * @return
     */
    @POST
    @Path("/app/v1/{name}/feedback")
    public RestResponse<AppVO> feedback(@PathParam("name") String appName, FeedbackVO feedback);
}
